SQLite = Import('SQLite.py')

def open(path):
    db = SQLite.Database(path)
    db.create('messages',
        ('id_topic','INTEGER'),
        ('id_parent_msg','INTEGER'),
        ('author','INTEGER'),
        ('text','TEXT'),
        ('created','TEXT'),
        mode="open")
    db['messages'].is_datetime('created')
    db.create('topics',
        ('title','TEXT'),
        ('author','TEXT'),
        ('created','TEXT'),
        ('last_editor','TEXT'),
        ('last_modif','TEXT'),
        ('nb_messages','INTEGER'),
        ('nb_authors','INTEGER'),
        ('nb_visits','INTEGER'),
        mode="open")
    db['topics'].is_datetime('created')
    db['topics'].is_datetime('last_modif')
    return db
